const state = {
	home:{}
}
const getters={
	 // 商品分类
	  categoryList(state) {
	    return state.home.categoryList || [];
	  },
	  // 热销商品
	  hotSkuList(state) {
	    return state.home.hotSkuList || [];
	  },
	  // 新人专享
	  newPersonSkuInfoList(state) {
	    return state.home.newPersonSkuInfoList || [];
	  },
	  // 提货点信息
	  leaderAddressVo(state) {
	    return state.home.leaderAddressVo || {};
	  },
	  // 秒杀时间
	  seckillTime(state) {
	    return state.home.seckillTime || {};
	  },
	  // 秒杀商品
	  seckillSkuVoList(state) {
	    return state.home.seckillSkuVoList || [];
	  },
}
const mutations = {
	getHomeIndexMutation(state,payload){
		state.home = payload
	}
}
const actions = {
	async getHomeIndexAction({commit,dispatch}){
		let res = await this._vm.$u.api.getHomeIndex()
		// console.log(res)
		await commit("getHomeIndexMutation",res)
		//通过dispatch触发另一个模块仓库的actions事件 leaderAddressVo这个数据目前只能通过index模块获取
		await dispatch("pickUpLocationModule/changeLeaderAddressVoAction",res.leaderAddressVo,{root:true})
	}
}
export default {
	namespaced:true,
	state,
	getters,
	mutations,
	actions
}